import 'util.dart';

///author: create by SunJH
///时间: 2021/12/16 0016
///邮箱: 965989158@qq.com
///描述: 单例的测试类

class InstanceTest{
  Util? _util;
  InstanceTest._pre(this._util);
  InstanceTest._();
  static InstanceTest? _instanceTest;

  static InstanceTest get Instance => _instanceTest??=InstanceTest._();
  static Future<InstanceTest> preInit() async {
    if (_instanceTest == null) {
      var preferences = await Util.getInstance();
      print("Util实例化");
      _instanceTest = InstanceTest._pre(preferences);
    }
    return _instanceTest!;
  }
  Loge(dynamic info){
    if(_util == null){
      throw "please call preInit";
    }
    _util?.printInfo(info);
  }
}